#ifndef prs_FrmScrollBarStyle_H
#define prs_FrmScrollBarStyle_H

#include "prs_FrmFunc.h"
#include "prs_FrmRules.h"
#include "prs_FrmStyleState.h"
#include "prs_FrmButtonStyle.h"
#include "frm_control_TScrollBar.h"

namespace prs {

////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

struct TNodeFrmHScrollBarStyle : public TNodeStyleControl
{
  DECLARE_ClientNode()
  TAttrNodeType<nodeType_HScrollBar> NodeType;
  TAttrObject<nodeType_Style,frm::control::TScrollBarHorz::TStyle> Style;
  //
  TNodeFrmHScrollBarStyle() : NodeType(this),Style(this) {}
};

///////////////////////////////////////////////////////////////////////////////

struct TRuleFrmHScrollBarStyle : public snt::TRule
{
  TRuleFrmHScrollBarStyle(
    snt::text::TContext &Context,
    svl::TVariant &VParentNode,
    TRuleFrmStyleState &RStyleState
  );
  
private:  
  TNodeFrmHScrollBarStyle *GetNode() { return dynamic_cast<TNodeFrmHScrollBarStyle*>(vParentNode.Pointer());}
  //
  void FScrollBar(snt::TParams &Params) { rStyleState.SetState(&GetNode()->Style.Value ); }
  bool FBegButton(snt::text::TIdent::TFuncClosureDoEntryParams &Params);
  bool FEndButton(snt::text::TIdent::TFuncClosureDoEntryParams &Params);
  bool FBegPage(snt::text::TIdent::TFuncClosureDoEntryParams &Params);
  bool FEndPage(snt::text::TIdent::TFuncClosureDoEntryParams &Params);
  bool FSplitter(snt::text::TIdent::TFuncClosureDoEntryParams &Params);
  bool FWeight(snt::text::TNumber::TFuncClosureDoEntryParams &Params);
  //
  frm::control::TButton::TStyle* GetButtonStyle(const svl::TString &Style,svl::TString &Errors);
  //
  svl::TVariant &vParentNode;
  snt::TAlter A;
  TRuleFrmStyleState &rStyleState;
};

////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

struct TNodeFrmVScrollBarStyle : public TNodeStyleControl
{
  DECLARE_ClientNode()
  TAttrNodeType<nodeType_VScrollBar> NodeType;
  TAttrObject<nodeType_Style,frm::control::TScrollBarVert::TStyle> Style;
  //
  TNodeFrmVScrollBarStyle() : NodeType(this),Style(this) {}
};

///////////////////////////////////////////////////////////////////////////////

struct TRuleFrmVScrollBarStyle : public snt::TRule
{
  TRuleFrmVScrollBarStyle(
    snt::text::TContext &Context,
    svl::TVariant &VParentNode,
    TRuleFrmStyleState &RStyleState
  );
  
private:  
  TNodeFrmVScrollBarStyle *GetNode() { return dynamic_cast<TNodeFrmVScrollBarStyle*>(vParentNode.Pointer());}
  //
  void FScrollBar(snt::TParams &Params) { rStyleState.SetState(&GetNode()->Style.Value ); }
  bool FBegButton(snt::text::TIdent::TFuncClosureDoEntryParams &Params);
  bool FEndButton(snt::text::TIdent::TFuncClosureDoEntryParams &Params);
  bool FBegPage(snt::text::TIdent::TFuncClosureDoEntryParams &Params);
  bool FEndPage(snt::text::TIdent::TFuncClosureDoEntryParams &Params);
  bool FSplitter(snt::text::TIdent::TFuncClosureDoEntryParams &Params);
  bool FWeight(snt::text::TNumber::TFuncClosureDoEntryParams &Params);
  //
  frm::control::TButton::TStyle* GetButtonStyle(const svl::TString &Style,svl::TString &Errors);
  //
  svl::TVariant &vParentNode;
  snt::TAlter A;
  TRuleFrmStyleState &rStyleState;
};

///////////////////////////////////////////////////////////////////////////////
}

#endif
